﻿/*
*author:徐洪昌
*blog:http://cnblogs.com/xusir
*datetime:${Utils.GetDate} ${Utils.GetTime}
*/ 
 /*数据列表，状态审核，删除，排序*/
var ActionUrl=adminUrl+"${table.TableNameAlias}_";

#foreach($c in $ColumnList)
	#if($c.IsPrimary)
		#set ($primaryKeyAlias=$c.ColumnNameAlias)
	#set ($primaryKey=$c.ColumnName)
	#end
#end
 jQuery(function(){
      SetSelect(Enum.SwitchStatus, "SelectStatus", 1);
    LoadList();
    commonBO.initOperatePower();
 });
 /*数据列表*/
 function LoadList() {
  commonBO.initDataGrid('');
 }

/*刷新页面*/
function reload() {
    commonBO.reload();
}
/*跳转到添加页面*/
function add() {
    location.href = "saveOrUpdate.jsp?id=0";
}
/*跳转到修改页面*/
function edit() {
    location.href = "saveOrUpdate.jsp?id=" + commonBO.SelectRowData.rowData.${Utils.ToTitleLower($primaryKeyAlias)};
}
/*跳转到详细页*/
function view() {
    location.href = "view.jsp?id=" + commonBO.SelectRowData.rowData.${Utils.ToTitleLower($primaryKeyAlias)};
}
/*
 * 启用或禁用
 * */
function audit(status) {
    var dataRows = jQuery("#dataList").datagrid("getSelections");
    var ids = "";
    for (var index in dataRows) {
        if (dataRows[index].status != status)
            ids += "," + dataRows[index].${Utils.ToTitleLower($primaryKeyAlias)};
    }
    commonBO.setAudit(ids, status);
}
/*删除*/
function del() {
    var dataRows = jQuery("#dataList").datagrid("getSelections");
    var ids = "";
    for (var index in dataRows) {
        ids += "," + dataRows[index].${Utils.ToTitleLower($primaryKeyAlias)};
    }
    commonBO.delFromId(ids);
}